package simple

// rearrangeCharacters https://leetcode.cn/problems/rearrange-characters-to-make-target-string/
func rearrangeCharacters(s string, target string) int {
	var works [26]int
	for _, c := range s {
		works[c-'a']++
	}
	count := 0
	for {
		for _, c := range target {
			if works[c-'a'] == 0 {
				return count
			}
			works[c-'a']--
		}
		count++
	}
}
